<script setup lang="ts">
import { Button as VanButton } from 'vant'

import { useUserStore } from '@/stores'
import { request } from '@/utils/request'
import type { User } from '@/types/user'

const store = useUserStore()

const fakeLogin = async () => {
  const res = await request<User>('/login/password', 'post', {
    mobile: '13230000002',
    password: 'abc12345'
  })

  console.log('真正请求 api', res.data.token)

  // 假的
  store.setUser(res.data)
}
</script>

<template>
  <div>首页</div>
  <van-button type="primary">aaaaa</van-button>


  <cp-icon name="login-eye-off" />
  <cp-icon name="login-eye-on" />
  <div class="box">盒子</div>
  <div>用户名: {{ store.user?.account }} 手机号: {{ store.user?.mobile }}</div>
  <button @click="fakeLogin">登录</button>
</template>

<style lang="scss">
.box {
  width: 37.5px;
  height: 37.5px;
  background: salmon;
}
</style>
